<?php get_header(); ?>
  <div class="path">
	<ol class="breadcrumb">
	  <li><a href="<?php echo home_url(); ?>">首页</a></li>
	  <li>
		<?php the_category(', '); ?> 
	  </li>
	  <li class="active"><?php the_title(); ?></li>
	</ol>  
  </div>
  <div class="gamesingle-body">
	  <div class="modal-content-hack">
		<div class="modal-header mainer-contentus-header ">
		  <li class="game-title"><?php the_title(); ?></li>
		  <li class="game-view"><?php echo '浏览量:'.getPostViews(get_the_ID()).'次'; ?></li>
		  <li class="game-edit"><?php edit_post_link('修改本文'); ?></li>
		  
		  <div class="clear"></div>
		</div>
		<div class="modal-body mainer-contentus-body">
		  <div class="gamesingle-show col-sm-6 col-md-6 col-lg-6">		  
            <div class="wrapper row">
                <div id="ei-slider" class="ei-slider">
                    <ul class="ei-slider-thumbs">
                        <li><a href="#">Slide 1</a><img src="" alt="thumb01" /></li>
                        <li><a href="#">Slide 2</a><img src="" alt="thumb02" /></li>
                        <li><a href="#">Slide 3</a><img src="" alt="thumb03" /></li>
                        <li><a href="#">Slide 4</a><img src="" alt="thumb04" /></li>
                    </ul><!-- ei-slider-thumbs -->				
                    <ul class="ei-slider-large">
						<?php if (have_posts()) : ?>   
						<?php while (have_posts()) : the_post(); ?>
						<?php $gamux_images = gamux_get_post_images(get_the_content()); ?>
                        <li>
							<img src="<?php echo $gamux_images[1][0]; ?>" alt="image01" />
                        </li>
                        <li>
                            <img src="<?php echo $gamux_images[1][1]; ?>" alt="image02" />

                        </li>
                        <li>
                            <img src="<?php echo $gamux_images[1][2]; ?>" alt="image03"/>
                        </li>
                        <li>
                            <img src="<?php echo $gamux_images[1][3]; ?>" alt="image04" />
                        </li>
						<?php endwhile; ?>
						<?php endif; ?>
                    </ul><!-- ei-slider-large -->

                </div><!-- ei-slider -->
            </div>
										
		  </div>
		  <div class="gamesingle-info col-sm-6 col-md-6 col-lg-6">
			<iframe class="steam-widget" src="<?php echo get_post_meta( $post->ID, 'steam', true ); ?>" frameborder="0"></iframe>
			<div class="gamesingle-info-body">
				<div class="gamesingle-info-left">
					<li>游戏名称：<?php the_title(); ?></li>
					<li>游戏类型：<?php the_category(', '); ?></li>	
					<li>外文名称：<?php echo gamux_post_slug(); ?></li>
					<li>开发公司：<?php echo get_post_meta( $post->ID, 'devcorp', true ); ?></li>
					<li>发行公司：<?php echo get_post_meta( $post->ID, 'distrcorp', true ); ?></li>
					<li>发行时间：<?php echo get_post_meta( $post->ID, 'distrtime', true ); ?></li>
					<li>官网地址：<a href="<?php echo get_post_meta( $post->ID, 'website', true ); ?>">点击进入</a></li>	
				</div>
				<div class="gamesingle-info-right">
					<li>添加日期：<?php the_time('Y年m月d日'); ?></li>
					<li>代码协议：<?php echo get_post_meta( $post->ID, 'copyright', true ); ?></li>					
					<li>游戏容量：<?php echo get_post_meta( $post->ID, 'capacity', true ); ?></li>
					<li>游戏版本：<?php echo get_post_meta( $post->ID, 'version', true ); ?></li>
					<li>中文支持：
					<?php  if(in_category(94)) echo '是';else echo'否'; ?>
					</li>
					<li><span class="gamesingle-tag"><?php the_tags('<strong>标签：</strong> ', ' , ' , ''); ?></span></li>
				</div>
				<div class="clear"></div>
			</div>
			<div class="gamesingle-authandmain visible-lg">
				<div class="col-lg-6">
				  <div class="gamesingle-author-avatar col-lg-4">
					<div class="row"><?php echo get_avatar(disnametoid(get_the_author()), 64); ?></div>
				  </div>
				  <div class="gamesingle-author-info col-lg-8">
				  <div class="row">
					<div class="gamesingle-author-info-desc">
					该游戏创建者
					</div>
					<div class="gamesingle-author-info-name">
					<?php $ai=get_post($post->ID)->post_author; the_author_meta('display_name', $ai); ?>
					</div>
					<div>
					 <?php the_time('Y-m-d'); ?>
					</div>
				  </div>
				  </div>
				</div>
				<div class="col-lg-6">
				  <div class="gamesingle-author-avatar col-lg-4">
					<div class="row"><?php echo get_avatar(disnametoid(get_the_modified_author()), 64); ?></div>
				  </div>
				  <div class="gamesingle-author-info col-lg-8">
				  <div class="row">
					<div class="gamesingle-author-info-desc">
					现任维护人员
					</div>
					<div class="gamesingle-author-info-name">
					 <?php echo get_the_modified_author(); ?> 
					</div>
					<div>
					 <?php echo get_the_modified_time('Y-m-d'); ?>
					</div>
				  </div>
				  </div>
				</div>
				<div  class="clear"></div>
			</div>
		  </div>
		</div>
	  </div>
	  <div class="gamesingle-content">
		<div class="gamesingle-content-left col-sm-9 col-md-9 col-lg-9">
			<div class="gamecontent modal-content-hack">
			  <div class="gamecontent-body">
				<?php if (have_posts()) : ?>   
				<?php while (have_posts()) : the_post(); setPostViews(get_the_ID()); ?>
				<?php the_content(); ?>
				<?php endwhile; ?>
				<?php endif; ?>
			  </div>
			  <div class="reprint modal-content-hack">
				<blockquote>
				<small>
				  <div>本站地址: www.gamux.org</div>
				  <div>本文地址: <?php echo get_permalink(); ?></div>
				  <div>本站文章皆采用by-nc-sa 3.0协议，欢迎各位转载，麻烦转载带上引用信息吧。</div>
				  <div>——现任站长: saro(qq15553894874)<del>(这句不用带)</del></div>
				</small>
				</blockquote>			
			  </div>
			</div>
			<div class="comments">
			 
				<?php comments_template( '', true ); ?>
			</div>
		</div>
		<div class="gamesingle-content-right col-sm-3 col-md-3 col-lg-3">
		  <div class="game-rating modal-content-hack">
			<div class="perrating">
			<li><span class="single-rating">★★★★★</span><span class="single-rating-num"><?php echo get_post_vote($post->ID,'up').'票'; ?></span></li>
			<li><span class="single-rating">★★★★☆</span><span class="single-rating-num"><?php echo get_post_vote($post->ID,'subup').'票'; ?></span></li>
			<li><span class="single-rating">★★★☆☆</span><span class="single-rating-num"><?php echo get_post_vote($post->ID,'mid').'票'; ?></span></li>
			<li><span class="single-rating">★★☆☆☆</span><span class="single-rating-num"><?php echo get_post_vote($post->ID,'subdown').'票'; ?></span></li>
			<li><span class="single-rating">★☆☆☆☆</span><span class="single-rating-num"><?php echo get_post_vote($post->ID,'down').'票'; ?></span></li>
			</div>
			<div>总体评分：<span class="vote_ave_num"></span>/5分</div>
			请投票:<br />
			<?php if (have_posts()) : ?>   
			<?php while (have_posts()) : the_post(); ?>     
				<span class="vote_down vote-span" id="<?php echo 'vote_down'.$post->ID;?>">     
					<a href="javascript:void(0);" rel="<?php echo 'down_'.$post->ID;?>" class="vote-click" title="一分">☆</a>    
				</span>
				<span class="vote_subdown vote-span" id="<?php echo 'vote_subdown'.$post->ID;?>">     
					<a href="javascript:void(0);" rel="<?php echo 'subdown_'.$post->ID;?>" class="vote-click" title="二分">☆</a>   
				</span>
				<span class="vote_mid vote-span" id="<?php echo 'vote_mid'.$post->ID;?>">     
					<a href="javascript:void(0);" rel="<?php echo 'mid_'.$post->ID;?>" class="vote-click" title="三分">☆</a>    
				</span>
				<span class="vote_subup vote-span" id="<?php echo 'vote_subup'.$post->ID;?>">     
					<a href="javascript:void(0);" rel="<?php echo 'subup_'.$post->ID;?>" class="vote-click" title="四分">☆</a>    
				</span> 
				<span class="vote_up vote-span" id="<?php echo 'vote_up'.$post->ID;?>">     
					<a href="javascript:void(0);" rel="<?php echo 'up_'.$post->ID;?>" class="vote-click" title="五分">☆</a>     
				</span>
				<span id="selectStars"></span>
			<?php endwhile; ?>  
			<?php endif; ?>

		  </div>

		  <div class="gamesingle-authors  modal-content-hack">
		    <li>贡献作者（只记录左侧游戏介绍）：</li>
			<div class="show-authors">
			<?php $rev = wp_get_post_revisions( $post->ID, 'revision' );
			$i=0;
			foreach($rev as $k=>$v){					
				$output[$i] = get_avatar($v->post_author,24).get_the_author_meta('display_name', $v->post_author);
				$i++;
			}
			$output =array_reverse(array_unique($output));
			foreach($output as $k=>$v){
				$author_list = '<span>'.$v.'</span> ';
				echo $author_list;
			}
			?>
			</div>
		  </div>
		</div>
		<div class="clear"></div>
	  </div>
  </div>
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/single-game.css" type="text/css">
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/library/slide.jquery.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/library/jquery.easing.1.3.js"></script>
	<script type="text/javascript">var ajax_url = '<?php echo admin_url(); ?>admin-ajax.php';</script> 
        <script type="text/javascript">
            $(function() {
                $('#ei-slider').eislideshow({
					easing		: 'easeOutExpo',
					titleeasing	: 'easeOutExpo',
					titlespeed	: 1200
                });
            });
        </script>		
<script>
/**      
 * ding 
    
 */     
       
function getCookie(name) {     
    var start = document.cookie.indexOf( name + "=" );     
    var len = start + name.length + 1;     
    
    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )     
        return null;     
    
    if ( start == -1 )     
        return null;     
    
    var end = document.cookie.indexOf( ';', len );     
    
    if ( end == -1 )     
        end = document.cookie.length;     
    return unescape( document.cookie.substring( len, end ) );     
}     
function ashu_isCookieEnable() {     
    var today = new Date();     
    today.setTime( today.getTime() );     
    var expires_date = new Date( today.getTime() + (1000 * 60) );     
    
    document.cookie = 'ashu_cookie_test=test;expires=' + expires_date.toGMTString() + ';path=/';     
    var cookieEnable = (getCookie('ashu_cookie_test') == 'test') ?  true : false;     
    //document.cookie = 'ludou_cookie_test=;expires=Fri, 3 Aug 2001 20:47:11 UTC;path=/';     
    return cookieEnable;     
}           
$(document).ready(function($) {     
    var ashu_token = 1;     
    $('.vote-span a').click(function(){     
        //检查浏览器是否启用cookie功能     
        if( !ashu_isCookieEnable() ) {     
            alert("很抱歉，您不能给本文投票！");     
            return;     
        }     
        if( ashu_token != 1 ) {     
            alert("您的鼠标点得也太快了吧？！");     
            return false;     
        }     
        ashu_token = 0;     
        //获取投票a标签中的rel值     
        var full_info = $(this).attr( 'rel' );     
        var arr_param = full_info.split( '_' ); //以字符"_"分割     
        //发起ajax     
        $.ajax({     
            url:ajax_url, //ajax地址     
            type:'POST',     
            //请求的参数包括action   rating  postid三项     
            data:'action=vote_post&rating=' + arr_param[ 0 ] + '&postid=' + arr_param[ 1 ],     
            //返回数据     
            success:function(results){     
                if(results=='n'){     
                    alert('评价失败');     
                    ashu_token = 1;     
    
                }     
                if (results=='y'){     
                    ashu_token = 1;
                         
                }     
                if (results=='h'){     
                    ashu_token = 1;     
                    alert('未登录或已评分！');     
                }     
                if (results=='e'){     
                    ashu_token = 1;     
                    alert('评价失败');     
                }     
            }     
        });     
    });     
}); 
</script>
<script>
$.post(ajax_url, {action: "ave_num",gameid: "<?php echo $post->ID; ?>"}, function(rep){ 
	$(".vote_ave_num").text(rep);
});
$('.vote-click').click(function() {
	$.post(ajax_url, {action: "ave_num",gameid: "<?php echo $post->ID; ?>"}, function(rep2){ 
		$(".vote_ave_num").text(rep2);
	});
});
</script>
<script>
$(document).ready(function(){
  $('.vote-click').hover(function(){
	  var lt=getStars($(this).attr('title'));	  
		  $('.game-rating span a').slice(0,lt).text('★');
		  $('.game-rating span a').slice(lt,5).text('☆');
		  $('#selectStars').text($(this).attr('title'));
  })
});
//通过类名判断星星数
function getStars(stars){
	var re=1;
	switch(stars){
		case '一分':re=1;break;
		case '二分':re=2;break;
		case '三分':re=3;break;
		case '四分':re=4;break;
		case '五分':re=5;break;
	}
	return re;
}
</script>
<?php get_footer(); ?>
